﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AnalysisVideoSubtitle
{
    public partial class BaiduParameFrm : Form
    {
        public BaiduParameFrm()
        {
            InitializeComponent();
        }


        private void LinkBaidu_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("iexplore.exe", "http://ai.baidu.com/tech/ocr/general");
        }

        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (txtAppID.Text.Trim().IsNullOrWhiteSpace() ||
                txtAPIKey.Text.Trim().IsNullOrWhiteSpace() ||
                txtSecretKey.Text.Trim().IsNullOrWhiteSpace())
            {
                MessageBox.Show("参数不可以为空");
                return;
            }
            Data.APP_ID = txtAppID.Text.Trim();
            Data.API_KEY = txtAPIKey.Text.Trim();
            Data.SECRET_KEY = txtSecretKey.Text.Trim();
            SettingData.WriteIniData();
            this.DialogResult = DialogResult.OK;
        }

        private void BaiduParameFrm_Load(object sender, EventArgs e)
        {
            txtAppID.Text = Data.APP_ID;
            txtAPIKey.Text = Data.API_KEY;
            txtSecretKey.Text = Data.SECRET_KEY;
        }
    }
}
